package com.yz.mcd;

import android.app.Application;
import android.widget.Toast;

import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
import com.yz.mcd.bean.UserInfoBean;

/**
 * Created by XYLi on 2017/4/21.
 */

public class BaseApplication extends Application {

    private static RequestQueue requestQueue=null;//Volley的一个对象通常实例化一个就够了
    private static UserInfoBean userInfo=null;//当前用户信息
    private static BaseApplication baseApplicationSelf;
    private static String requestKey;//当前认证标识（接口中的user_id）

    public BaseApplication(){

        userInfo=new UserInfoBean();
        baseApplicationSelf=this;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        requestQueue= Volley.newRequestQueue(getApplicationContext());
    }

    public static RequestQueue getRequestQueue(){
        return requestQueue;
    }

    public static UserInfoBean getUserInfo(){
        return userInfo;
    }

    public static BaseApplication getBaseApplicationSelf(){return baseApplicationSelf;}

    //页面的提示信息
    public static void cout(String info) {
        Toast.makeText(baseApplicationSelf,info, Toast.LENGTH_SHORT).show();
    }

    public static String getRequestKey(){return requestKey;}
    public static void setRequestKey(String key){requestKey=key;}
}
